using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Xml;
using System.IO;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Common;
namespace LocalizationToolkit_DAL
{
    public class PropertyValues:Localization
    {
        
        

        public DataSet GetPropertyValues(int ApplicationID, int ApplicationCultureID) {
            try
            {
                DataSet ds = new DataSet();



                this.cmd = new SqlCommand("usp_get_propertyvalue_per_culture");
                this.cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter par = new SqlParameter("@ApplicationID", SqlDbType.Int);
                par.Value = ApplicationID;
                this.cmd.Parameters.Add(par);
                SqlParameter par2 = new SqlParameter("@ApplicationCultureID", SqlDbType.Int);
                par2.Value = ApplicationCultureID;
                this.cmd.Parameters.Add(par2);

                ds = ExecuteDatabaseCommand(ds);

                return ds;
            }
            finally
            {
            }
        }

        public DataSet GetPropertyValue(int CulturePropertyID)
        {
            try
            {
                DataSet ds = new DataSet();



                this.cmd = new SqlCommand("usp_get_propertyvalue_by_ID");
                this.cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter par = new SqlParameter("@CulturePropertyID", SqlDbType.Int);
                par.Value = CulturePropertyID;
                this.cmd.Parameters.Add(par);
                

                ds = ExecuteDatabaseCommand(ds);

                return ds;
            }
            finally
            {
            }
        }
        public Boolean UpdateInvariant(int CulturePropertyID, string PropertyValue)
        {
            try
            {



                this.cmd = new SqlCommand("dbo.usp_update_propertyvalue");
                this.cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter par = new SqlParameter("@CulturePropertyID", SqlDbType.Int);
                par.Value = CulturePropertyID;
                this.cmd.Parameters.Add(par);
                SqlParameter par2 = new SqlParameter("@PropertyValue", SqlDbType.NVarChar, 4000);
                par2.Value = PropertyValue;
                this.cmd.Parameters.Add(par2);
                if (ExecuteNonQuery() > 0)
                    return true;
                else
                    return false;

            }
            finally
            {
            }

        }
       
    }
}
